Skip to content

Add poethepoet config#1976

Merged
dlech merged 5 commits intohbldh:developfrom
timrid:poethepoet
May 9, 2026
Merged

Add poethepoet config#1976
dlech merged 5 commits intohbldh:developfrom
timrid:poethepoet

Conversation

@timrid
Copy link
Copy Markdown
Contributor

@timrid timrid commented May 2, 2026

This is an alternative to #1922 that uses poethepoet instead of tox as you suggested.

Some examples of the new commands:

  • uv run poe test-py310: Run pytest on Python 3.10
  • uv run poe test-py310 --bleak-hci-transport=serial:/dev/tty.usbmodem1101: Run integration tests on Python 3.10
  • uv run poe test-all: Run pytest on all Python versions
  • uv run poe test-all --bleak-hci-transport=serial:/dev/tty.usbmodem1101: Run integration tests on all Python versions
  • uv run poe lint: Run code linters (isort, black, flake8)
  • uv run poe lint --checkonly: Run code linters (isort, black, flake8) without changing anything (mainly for CI usage)
  • uv run poe typecheck: Run type checkers (mypy, pyright)
  • uv run poe docs: Building the docs

This is only the groundwork for all current functions of bleak. I plan to expand the poethepoet config in #1944 to add "cross-platform" type checking for the new Android backend. And additionaly in #1853 to add type checking for multiple backends (pyobjc and rubicon-objc).

It took some time to find a good way to pass the --bleak-hci-transport or --bleak-bluez-vhci options to the pytests. Finally I created nat-n/poethepoet#380 that simplifies this problem an which is now released in poethepoeth v0.45.0.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.08%. Comparing base (058c4e2) to head (78aeb00).
⚠️ Report is 12 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1976      +/-   ##
===========================================
+ Coverage    51.26%   52.08%   +0.82%     
===========================================
  Files           39       43       +4     
  Lines         3938     4091     +153     
  Branches       488      503      +15     
===========================================
+ Hits          2019     2131     +112     
- Misses        1791     1830      +39     
- Partials       128      130       +2     
Flag Coverage Δ
bluez-integration-py3.10 ?
bluez-integration-py3.11 ?
bluez-integration-py3.12 ?
bluez-integration-py3.13 ?
bluez-integration-py3.14 ?
bluez-integration-py310 38.74% <ø> (?)
bluez-integration-py311 38.74% <ø> (?)
bluez-integration-py312 38.74% <ø> (?)
bluez-integration-py313 38.76% <ø> (?)
bluez-integration-py314 37.22% <ø> (?)
macos-latest-py3.10 ?
macos-latest-py3.11 ?
macos-latest-py3.12 ?
macos-latest-py3.13 ?
macos-latest-py3.14 ?
macos-latest-py310 20.06% <ø> (?)
macos-latest-py311 20.06% <ø> (?)
macos-latest-py312 20.06% <ø> (?)
macos-latest-py313 20.06% <ø> (?)
macos-latest-py314 19.87% <ø> (?)
ubuntu-latest-py3.10 ?
ubuntu-latest-py3.11 ?
ubuntu-latest-py3.12 ?
ubuntu-latest-py3.13 ?
ubuntu-latest-py3.14 ?
ubuntu-latest-py310 23.95% <ø> (?)
ubuntu-latest-py311 23.95% <ø> (?)
ubuntu-latest-py312 23.95% <ø> (?)
ubuntu-latest-py313 23.95% <ø> (?)
ubuntu-latest-py314 22.06% <ø> (?)
windows-latest-py3.10 ?
windows-latest-py3.11 ?
windows-latest-py3.12 ?
windows-latest-py3.13 ?
windows-latest-py3.14 ?
windows-latest-py310 18.74% <ø> (?)
windows-latest-py311 18.74% <ø> (?)
windows-latest-py312 18.74% <ø> (?)
windows-latest-py313 18.74% <ø> (?)
windows-latest-py314 18.47% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@timrid timrid mentioned this pull request May 2, 2026
Comment thread .github/workflows/build_and_test.yml Outdated

- name: Test with pytest
run: uv run pytest -v --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
run: uv run poe test-py${{ matrix.python-version }} -v --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this make it more verbose since the commands in pyproject.toml also include -v?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. The -v is doubled. I removed the -v in the .yml.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces ad-hoc local/CI developer commands with centralized poethepoet tasks in pyproject.toml, so Bleak’s linting, testing, type checking, and docs workflows can be run consistently through uv run poe ....

Changes:

  • Add poethepoet as a development dependency and define shared poe tasks for tests, linting, type checking, and docs.
  • Update GitHub Actions workflows to invoke the new poe tasks instead of duplicating shell commands.
  • Refresh contributor instructions and Alpine VM setup to support the new task-based workflow.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
uv.lock Locks poethepoet and its transitive dependencies for the dev environment.
pyproject.toml Adds poethepoet, updates mypy/pytest config, and defines the new shared task runners.
CONTRIBUTING.rst Switches contributor guidance to the new uv run poe ... commands.
.github/workflows/format_and_lint.yml Replaces direct lint/docs commands with centralized poe tasks.
.github/workflows/build_and_test.yml Reworks CI test and typecheck execution to use the new poe task definitions.
.github/alpine-vm/start-alpine-vm.sh Adds git to the Alpine VM packages to support the updated CI execution path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@timrid timrid requested a review from dlech May 2, 2026 20:15
Comment thread .github/workflows/build_and_test.yml Outdated
Comment thread pyproject.toml Outdated
VM_SSH_PORT="2222"
VM_CONSOLE_LOG="vm-console.log"
VM_PACKAGES="bluez openssh uv"
VM_PACKAGES="bluez openssh uv git"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does poe invoke git?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that isn't strictly necessary for poe. But during the development of my poe PR, I installed poe directly from a Git branch, and that only works if Git is also installed on the system. Since Git is also listed as a prerequisite in CONTRIBUTING.rst, I just left it in there so people don't run into that issue again.

Comment thread pyproject.toml Outdated
{ cmd = "flake8 . --count --show-source --statistics", executor = { group = "lint" } },
]
args = [{ name = "checkonly", type = "boolean" }]
executor = { group = "lint" }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have this here, do we need the same on each command in the sequence?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The executor option in sequence tasks does not seem to have any effect. In other words, it is not passed on to the child tasks. Therefore, the executor must be explicitly specified in each of the cmd tasks. While the poethepoet documentation does not mention this, I discovered it through experimentation.

During testing, I also noticed that with the --group "test" executor option, all dev dependencies are still installed, since dev is installed by default unless you explicitly exclude it using --no-group "dev". To avoid installing all the unnecessary dependencies, I therefore added --no-group "dev" everywhere as well.

@timrid timrid requested a review from dlech May 9, 2026 09:09
@dlech dlech merged commit a1a096d into hbldh:develop May 9, 2026
23 checks passed
@dlech
Copy link
Copy Markdown
Collaborator

dlech commented May 9, 2026

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants